﻿using Entity;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IRepository
{
    public interface ITransferOrderRepository
    {
        // 修正：添加ioStatus参数
        Task<List<TransferOrderDTO>> GetTransferOrdersAsync(
            string transnoNo,
            string documentStatus,
            string ioStatus, // 新增
            DateTime? startDate,
            DateTime? endDate,
            int pageIndex,
            int pageSize);

        // 修正：添加ioStatus参数
        Task<int> GetTransferOrdersCountAsync(
            string transnoNo,
            string documentStatus,
            string ioStatus, // 新增
            DateTime? startDate,
            DateTime? endDate);

        // 新增：删除单条
        Task<bool> DeleteAsync(int transferOrderId);

        // 新增：批量删除
        Task<bool> BatchDeleteAsync(List<int> ids);

     
        // 新增：根据ID查询单条
        Task<TransferOrderDTO> GetByIdAsync(int id);

        // 新增：新增调拨单
        Task<bool> AddAsync(TransferOrderCreateDTO dto);
        // ITransferOrderRepository 接口中添加
      
        Task<List<TransferOrderDetailDTO>> GetDetailsByOrderIdAsync(int transferOrderId);
        Task<bool> AuditAsync(int transferOrderId, string auditor);
        Task<bool> AuditAsync(int transferOrderId, string auditor, string auditResult);
        Task<List<TransferOrderExportDTO>> GetExportDataAsync(
            string transnoNo, string documentStatus, string ioStatus,
            DateTime? startDate, DateTime? endDate);
        Task UpdateAsync(TransferOrderDTO transferOrder);
        Task<bool> CancelAsync(int transferOrderId, string operatorUser);
        // 新增带事务的重载方法（核心）
        Task<bool> AuditAsync(int transferOrderId, string auditor, string auditResult, DbTransaction transaction);
        Task UpdateAsync(TransferOrderDTO transferOrder, DbTransaction transaction);
        Task<TransferOrderDTO> GetByIdAsync(int id, DbTransaction transaction); // 2参数重载
        Task<List<TransferOrderDetailDTO>> GetDetailsByOrderIdAsync(int transferOrderId, DbTransaction transaction); // 2参数重载

    }
}
